* 1) Open NMG file and merge in local house price appreciation ----

use "${datadir_nmg}\nmg_la.dta", replace

ren localauthoritycode areacode
merge m:1 areacode datem using ///
	"${datadir}\local_price_appreciation", keep(1 3) nogen

replace appreciation1 = appreciation1/100 // on a different scale than other appreciation variables



* 2) Add forward-looking appreciation by re-matching ----

ren appreciation1 past_appreciation1
ren appreciation2 past_appreciation2

gen datem_interview = datem 


replace datem = datem + 24

merge m:1 areacode datem using ///
	"${datadir}\local_price_appreciation_2020", keep(1 3)

replace appreciation1 = appreciation1/100 

ren appreciation1 fut_appreciation1
ren appreciation2 fut_appreciation2

ren datem datem_24m



* 3) Rename variables to follow old regression code ----

ren past_appreciation1 appreciation1 
ren past_appreciation2 appreciation2

ren datem_interview datem



* 4) Save ----

save "${datadir}\expectation_appreciation_data", replace
